package com.wqtz.chechai.adapter;

import android.graphics.Color;
import android.view.View;
import android.widget.TextView;

import com.wqtz.chechai.R;
import com.wqtz.chechai.base.lvbaseadapter.LvBaseAdapter;
import com.wqtz.chechai.base.lvbaseadapter.ViewHolder;
import com.wqtz.chechai.bean.MsgBean;

import java.util.List;

/**
 * 项目名称： CheChai
 * 创建人 : Liberation
 * 创建时间: 2016/12/29 14:36
 */

public class CarCheckInfoAdapter extends LvBaseAdapter<MsgBean> {
	public CarCheckInfoAdapter(int resId) {
		super(resId);
	}

	@Override
	public void bindDatas(List<MsgBean> list, int position, ViewHolder holder) {
		if(position==0){
			holder.getView(R.id.line1).setVisibility(View.INVISIBLE);
			holder.getView(R.id.icon_status).setBackgroundResource(R.mipmap.ico_red_dot);
			TextView textView = (TextView) holder.getView(R.id.tv_status_info);
			textView.setTextColor(Color.BLACK);
		}else {
			holder.getView(R.id.line1).setVisibility(View.VISIBLE);
			holder.getView(R.id.icon_status).setBackgroundResource(R.mipmap.ico_gray_dot);
			TextView textView = (TextView) holder.getView(R.id.tv_status_info);
			textView.setTextColor(Color.GRAY);}

		if(position==list.size()-1){
			holder.getView(R.id.line2).setVisibility(View.INVISIBLE);
		}else {
			holder.getView(R.id.line2).setVisibility(View.VISIBLE);
		}
		holder.setText(R.id.tv_status_info,list.get(position).title);
		holder.setText(R.id.tv_status_time,list.get(position).time);
	}
}
